package cn.iocoder.yudao.module.engine.service.core.filter.read;

import cn.iocoder.yudao.module.engine.model.context.ControlEngineContext;
import cn.iocoder.yudao.module.engine.model.engine.EngineOutputData;
import cn.iocoder.yudao.module.engine.service.core.engine.IEngineConfigService;
import cn.iocoder.yudao.module.engine.service.core.pipeline.FilterAdapter;
import cn.iocoder.yudao.module.engine.service.core.pipeline.FilterContext;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class AttachAuxiliaryDataFilter extends FilterAdapter {
    @Resource
    private IEngineConfigService engineConfigService;

    @Override
    public void read(FilterContext ctx, ControlEngineContext engineContext) throws Exception {
        final EngineOutputData.AuxiliaryData auxiliaryData = new EngineOutputData.AuxiliaryData();
        engineContext.getOutputData().setAuxiliaryData(auxiliaryData);

        // 播放间隔（毫秒），随机
        final int playbackIntervalMs = engineConfigService.getPlaybackIntervalMs();
        auxiliaryData.setPlaybackIntervalMs(playbackIntervalMs);

        // 最后1个了
    }

}
